<?php
if(!defined('BZ_XTBLOG') || !defined('BZ_WJSCUZ')) {
	exit('Access Denied');
}
$fid =verify_id($_GET['fid']);
$act =$_GET['act'];
$flid =verify_id($_GET['flid']);
$forum=$db->get_one('forum_class'," `id` ='$fid'",'');
$wzxx_title =$forum['name'].'-论坛板块-'.$wzxx_title.'';
$wzxx_gj    =$forum['value'].'-论坛板块-'.$wzxx_gj.'';
$wzxx_ms    =$forum['value'].'-论坛板块-'.$wzxx_ms.'';

if(!$forum){
	  $pdid='1';
}else if($forum['sz_ydqx'] == '2' && !$user_uid){
	  $pdid='2';
}else{
	   if($forum['logo'] == '0' ){
	          if($forum['tzszj'] > 0 ){
	       	       $logo='images/forum/forum_new.gif';
	          }else{
	       	       $logo='images/forum/forum.gif';
	          }
	   }else{
	          $logo=$forum['logo'];
	   }
     $ltlogo=$logo;
     $ltid  =$forum['id'];
     $ltzs  =$forum['tzsz'];
     $lttsj =$forum['tzszj'];
     $ltts  =$forum['tzst'];
     $lthf  =$forum['tzsh'];
     $ltname=$forum['name'];
     $ltnamej=$ubb->content_ubb($forum['value']);
     $ltflsz =$forum['sz_fl'];

     $tzfl=$db->query('forum_tzfl'," `fid` ='$fid' ORDER BY `px` ",'');
     while($fl=mysql_fetch_array($tzfl)){
	      $ltfl[]= array('fid' => $fid ,'id' => $fl[id] ,'name' => $fl[name] );
     }

     $sqla=$db->query('forum'," `type_din` ='3' AND `sz_sc` ='0'",'');
     while($rowc=mysql_fetch_array($sqla)){
	     $rowc['name']  =Bingz_html($rowc['name']);
       if($rowc[nameys] =='0'){
          $ttname='<font color="#105CB6">'.$rowc['name'].'</font>';
       }else{
          $ttname='<font color="'.$rowc['nameys'].'">'.$rowc['name'].'</font>';
       }
        $tsj=Bingz_time($rowc['time_a']);
        $hyname=$user_class->user_name($row_b['uid']);
        $hytx  =$user_class->user_tx($row_b['uid']);
	      $lt3zd[]= array('sj' => $tsj,'hyid' => $rowc['uid'],'hyname' => $hyname,'id' => $rowc['id'],'name' => $ttname,'cks' => $rowc['cks'],'hfs' => $rowc['hfs']);
     }

     $sqlb=$db->query('forum'," `type_din` ='2' AND `sz_sc` ='0'",'');
     while($rowc=mysql_fetch_array($sqlb)){
       $ytzc=$db->get_one('forum_class'," `id` ='$rowc[cid]'",'');
      if($ytzc[fid] == $forum[fid]){
	     $rowc['name']  =Bingz_html($rowc['name']);
       if($rowc[nameys] =='0'){
          $ttname='<font color="#105CB6">'.$rowc['name'].'</font>';
       }else{
          $ttname='<font color="'.$rowc['nameys'].'">'.$rowc['name'].'</font>';
       }
        $tsj=Bingz_time($rowc['time_a']);
        $hyname=$user_class->user_name($row_b['uid']);
        $hytx  =$user_class->user_tx($row_b['uid']);
	      $lt2zd[]= array('sj' => $tsj,'hyid' => $rowc['uid'],'hyname' => $hyname,'id' => $rowc['id'],'name' => $ttname,'cks' => $rowc['cks'],'hfs' => $rowc['hfs']);
      }
     }

     $sqlc=$db->query('forum'," `type_din` ='1' AND `sz_sc` ='0' AND `cid` ='$forum[id]'",'');
     while($rowc=mysql_fetch_array($sqlc)){
	     $rowc['name']  =Bingz_html($rowc['name']);
       if($rowc[nameys] =='0'){
          $ttname='<font color="#105CB6">'.$rowc['name'].'</font>';
       }else{
          $ttname='<font color="'.$rowc['nameys'].'">'.$rowc['name'].'</font>';
       }
        $tsj=Bingz_time($rowc['time_a']);
        $hyname=$user_class->user_name($row_b['uid']);
        $hytx  =$user_class->user_tx($row_b['uid']);
	      $lt1zd[]= array('sj' => $tsj,'hyid' => $rowc['uid'],'hyname' => $hyname,'id' => $rowc['id'],'name' => $ttname,'cks' => $rowc['cks'],'hfs' => $rowc['hfs']);
     }

if($flid){
   $num_count=$db->num_rows('forum'," `cid` ='$fid' AND `fid` ='$flid' AND `type_din` ='0'  AND `sz_sc` ='0'",'id');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('forum'," `cid` ='$fid' AND `fid` ='$flid' AND `type_din` ='0' AND  `sz_sc` ='0' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
 }else if($act =='jh'){
   $num_count=$db->num_rows('forum'," `cid` ='$fid' AND `type_jin` ='1' AND `type_din` ='0' AND `sz_sc` ='0'",'id');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('forum'," `cid` ='$fid' AND `type_jin` ='1' AND `type_din` ='0' AND  `sz_sc` ='0' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
 }else if($act =='dt'){
   $num_count=$db->num_rows('forum'," `cid` ='$fid' AND `sz_sc` ='0'",'id');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('forum'," `cid` ='$fid' AND `type_din` ='0' AND `sz_sc` ='0' ORDER BY `time_a` DESC LIMIT ".$num_start." , ".$list_num." ",'');
 }else if($act =='bw'){
   $num_count=$db->num_rows('forum'," `cid` ='$fid' AND `type_din` ='0' AND `sz_sc` ='0'",'id');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('forum'," `cid` ='$fid' AND `type_din` ='0' AND `sz_sc` ='0' ORDER BY `time_a` DESC LIMIT ".$num_start." , ".$list_num." ",'');
   
     $tzfla=$db->query('forum_admin'," `fid` ='$fid' AND `type` ='0'  ORDER BY `id` ",'');
     while($flbz=mysql_fetch_array($tzfla)){
	      $ltbz[]= array('uid' => $flbz['uid'] ,'name' => $user_class->user_name($flbz['uid']));
     }
   
 }else{
   $num_count=$db->num_rows('forum'," `cid` ='$fid' AND `type_din` ='0' AND  `sz_sc` ='0'",'id');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('forum'," `cid` ='$fid' AND `type_din` ='0' AND `sz_sc` ='0' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
}
while($row_b=mysql_fetch_array($sql_bbs)){
	     $typeaa='';
		   $jing='';
		   $suo='';
		   $cun='';
		   if($row_b['type']=='1'){
		      $typea='投票';
		      $typeaa='<img src="images/forum/pollsmall.gif" alt="投票"/>';
	     }else if($row_b['type']=='2'){
		      $typea='悬赏';
		      $typeaa='<img src="images/forum/rewardsmall.gif" alt="悬赏"/>';
	     }else if($row_b['type']=='3'){
		      $typea='图片';
		      $typeaa='<img src="images/forum/data_tp.gif" alt="图片"/>';
	     }else if($row_b['type']=='4'){
		      $typea='附件';
		      $typeaa='<img src="images/forum/data_fj.gif" alt="附件"/>';
	     }else if($row_b['type']=='5'){
		      $typea='派币';
		      $typeaa='<img src="images/forum/viewpay.gif" alt="派币"/>';
       }
		   if($row_b['cun']==1){
	   	    $cun='<img src="images/forum/recommend_1.gif" alt="推荐"/>';
       }
		   if($row_b['type_jin']==1){
	   	    $jing='<img src="images/forum/digest_1.gif" alt="精华"/>';
       }
		   if($row_b['type_suo']==1){
		      $suo='<img src="images/forum/locked.gif" alt="锁定"/>';
       }
		   if($row_b['type_lx']==1){
		      $yckl='[<font color="#80FF80">隐</font>]';
		   }
      $tzbbst=$jing.$cxjh.$yckl;
      $num_start=$num_start+1;
      $tsj=Bingz_time($row_b['time_a']);
      if($forum[sz_fl] == '1'){
          $ttfl=$db->get_one('forum_tzfl'," `id` ='$row_b[fid]'",'');
          if($ttfl[name]){
             $tzfl='[<a href="index.php?'.$bzml.'=forum&amp;'.$bzmd.'=list&amp;fid='.$forum[id].'&amp;flid='.$ttfl[id].''.$bzsid.'" title="'.$ltname.'" ><font color="#FF0B0B">'.$ttfl[name].'</font></a>]';
          }else{
	           $tzfl="";
	        }
      }else{
          $tzfl="";
      }
	     $row_b['name']  =Bingz_html($row_b['name']);
       if($row_b[nameys] =='0'){
          $ttname='<font color="#105CB6">'.$row_b['name'].'</font>';
       }else{
          $ttname='<font color="'.$row_b['nameys'].'">'.$row_b['name'].'</font>';
       }
       $hyname=$user_class->user_name($row_b['uid']);
       $hytx  =$user_class->user_tx($row_b['uid']);
       $lttz[]= array('cun' => $cun,'suo' => $suo,'jing' => $jing,'hytx' => $hytx,'tzbst' => $tzbbst,'type' => $typea,'typeaa' => $typeaa,'flname' => $tzfl,'sj' => $tsj,'hyid' => $row_b['uid'],'hyname' => $hyname,'hynamesz' => $row_b['sz_lm'],'lx' => $row_b['id'],'cks' => $row_b['cks'],'hfs' => $row_b['hfs'],'id' => $row_b['id'],'name' => $ttname);
    }
   $db->free_result($sql_bbs);
   $page=page_link($list_num,$num_count);
}
@include template('head');
@include template('forum/forum_list');
@include template('foot');
?>